package com.neudu.ssrs_yyzxservice.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.neudu.ssrs_yyzxservice.mapper.CustomerMapper;
import com.neudu.ssrs_yyzxservice.pojo.Customer;
import com.neudu.ssrs_yyzxservice.pojo.Outward;
import com.neudu.ssrs_yyzxservice.service.OutwardService;
import com.neudu.ssrs_yyzxservice.mapper.OutwardMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author 86182
* @description 针对表【outward】的数据库操作Service实现
* @createDate 2025-04-17 09:48:10
*/
@Service
public class OutwardServiceImpl extends ServiceImpl<OutwardMapper, Outward>
    implements OutwardService{

    @Autowired
    private CustomerMapper customerMapper;

    @Autowired
    private OutwardMapper outwardMapper;

    @Override
    public List<Outward> getOutwardByBedId(Integer bedId) {
        // 根据 bed_id 查询 customer 表获取 customer_id
        Customer customer = customerMapper.getCustomerByBedId(bedId);
        if (customer != null) {
            Integer customerId = customer.getId();
            // 使用 customer_id 查询 outward 表
            return outwardMapper.getOutwardByCustomerId(customerId);
        }
        return null;
    }
}




